package com.digitalbonestudios.slugpug.tv;

import com.digitalbonestudios.framework.Music;
import com.digitalbonestudios.framework.Sound;
import com.digitalbonestudios.framework.gl.Animation;
import com.digitalbonestudios.framework.gl.Texture;
import com.digitalbonestudios.framework.gl.TextureRegion;
import com.digitalbonestudios.framework.impl.GLGame;

public class Assets {
	public static Texture pugItems;
	public static TextureRegion background;
	public static TextureRegion biscuit;
	public static TextureRegion bacon;
	public static TextureRegion steak;
	public static TextureRegion bone;
	public static TextureRegion headUp;
	public static TextureRegion headDown;
	public static TextureRegion headLeft;
	public static TextureRegion headRight;
	public static TextureRegion tailUp;
	public static TextureRegion tailDown;
	public static TextureRegion tailLeft;
	public static TextureRegion tailRight;
	public static TextureRegion body;
	public static TextureRegion logo;
	public static TextureRegion playButton;
	public static TextureRegion quitButton;
	public static TextureRegion resumeButton;
	public static TextureRegion helpButton;
	public static TextureRegion readyButton;
	public static TextureRegion soundOnButton;
	public static TextureRegion soundOffButton;
	public static TextureRegion playButtonRound;
	public static TextureRegion pauseButtonRound;
	public static TextureRegion gameOver;
	public static TextureRegion score;
	public static TextureRegion numbers;
	public static TextureRegion dirtPatch;
	public static TextureRegion tennisBall;
	public static TextureRegion dogBall;
	public static TextureRegion poop;
	public static TextureRegion pawPrint;
	public static TextureRegion playAgain;
	public static Animation steamingPoop;
	
	public static Music music;
	public static Sound bark;
	public static Sound bitten;
	public static Sound click;
	public static Sound eat;
	public static Sound stinky;
	public static Sound squish;
	
	public static void load(GLGame game) {
		pugItems = new Texture(game, "slug_pug.png");
		background = new TextureRegion(pugItems, 0, 704, 480, 320);
		biscuit = new TextureRegion(pugItems, 0, 0, 64, 64);
		bacon = new TextureRegion(pugItems, 64, 0, 64, 64);
		steak = new TextureRegion(pugItems, 0, 64, 64, 64);
		bone = new TextureRegion(pugItems, 320, 64, 64, 64);
		headUp = new TextureRegion(pugItems, 192, 0, 64, 64);
		headDown = new TextureRegion(pugItems, 128, 64, 64, 64);
		headLeft = new TextureRegion(pugItems, 64, 64, 64, 64);
		headRight = new TextureRegion(pugItems, 128, 0, 64, 64);
		tailUp = new TextureRegion(pugItems, 320, 0, 64, 64);
		tailDown = new TextureRegion(pugItems, 256, 64, 64, 64);
		tailRight = new TextureRegion(pugItems, 256, 0, 64, 64);
		tailLeft = new TextureRegion(pugItems, 192, 64, 64, 64);
		body = new TextureRegion(pugItems, 384, 0, 64, 64);
		logo = new TextureRegion(pugItems, 0, 128, 256, 256);
		playButton = new TextureRegion(pugItems, 0, 384, 192, 64);
		quitButton = new TextureRegion(pugItems, 0, 448, 192, 64);
		resumeButton = new TextureRegion(pugItems, 0, 512, 320, 64);
		helpButton = new TextureRegion(pugItems, 192, 448, 192, 64);
		readyButton = new TextureRegion(pugItems, 0, 576, 384, 128);
		soundOnButton = new TextureRegion(pugItems, 320, 320, 64, 64);
		soundOffButton = new TextureRegion(pugItems, 256, 320, 64, 64);
		playButtonRound = new TextureRegion(pugItems, 256, 384, 64, 64);
		pauseButtonRound = new TextureRegion(pugItems, 320, 384, 64, 64);
		gameOver = new TextureRegion(pugItems, 320, 512, 448, 64);
		score = new TextureRegion(pugItems, 384, 448, 256, 64);
		numbers = new TextureRegion(pugItems, 384, 640, 640, 64);
		dirtPatch = new TextureRegion(pugItems, 384, 576, 64, 64);
		tennisBall = new TextureRegion(pugItems, 256, 128, 64, 64);
		dogBall = new TextureRegion(pugItems, 320, 128, 64, 64);
		poop = new TextureRegion(pugItems, 256, 192, 64, 64);
		pawPrint = new TextureRegion(pugItems, 320, 192, 64, 64);
		playAgain = new TextureRegion(pugItems, 384, 384, 448, 64);
		steamingPoop = new Animation(0.2f,
						new TextureRegion(pugItems, 448, 0, 64, 64),
						new TextureRegion(pugItems, 512, 0, 64, 64),
						new TextureRegion(pugItems, 576, 0, 64, 64),
						new TextureRegion(pugItems, 640, 0, 64, 64));
		
		music = game.getAudio().newMusic("music.ogg");
		music.setLooping(true);
		music.setVolume(0.1f);
		if (Settings.soundEnabled)
			music.play();
		
		bark = game.getAudio().newSound("bark.ogg");
		bitten = game.getAudio().newSound("bitten.ogg");
		click = game.getAudio().newSound("click.ogg");
		eat = game.getAudio().newSound("eat.ogg");
		stinky = game.getAudio().newSound("stinky.ogg");
		squish = game.getAudio().newSound("squish.ogg");
		
	}
	
	public static void reload() {
		pugItems.reload();
		if (Settings.soundEnabled)
			music.play();
	}

	public static void playSound(Sound sound) {
		sound.play(1);
	}

}
